<?php

use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;
use App\User, App\Category;

class DatabaseSeeder extends Seeder {

	/**
	 * Run the database seeds.
	 *
	 * @return void
	 */
	public function run()
	{
		Model::unguard();

		$this->call('UserTableSeeder');
		$this->call('CategoryTableSeeder');
	}

}
class CategoryTableSeeder extends Seeder
{

	public function run()
	{
		DB::table('categories')->delete();

		Category::create(
			array(
				'title' => 'Air Freshener',
				'slug' => 'air-freshener',
				'image_url' => 'images/1079b7a0.1.jpg',
				'big_image_url' => 'images/b01146d5.slide1.jpg'
			)
		);
		Category::create(
			array(
				'title' => 'Household Care Product',
				'slug' => 'household-care-product',
				'image_url' => 'images/1079b7a0.1.jpg',
				'big_image_url' => 'images/b01146d5.slide1.jpg'
			)
		);
		Category::create(
			array(
				'title' => 'Personal Care Product',
				'slug' => 'personal-care-product',
				'image_url' => 'images/1079b7a0.1.jpg',
				'big_image_url' => 'images/b01146d5.slide1.jpg'
			)
		);
		Category::create(
			array(
				'title' => 'Auto Care Product',
				'slug' => 'auto-care-product',
				'image_url' => 'images/1079b7a0.1.jpg',
				'big_image_url' => 'images/b01146d5.slide1.jpg'
			)
		);
		Category::create(
			array(
				'title' => 'Insecticide & Pesticide',
				'slug' => 'insecticide&pesticide',
				'image_url' => 'images/1079b7a0.1.jpg',
				'big_image_url' => 'images/b01146d5.slide1.jpg'
			)
		);
		Category::create(
			array(
				'title' => 'Industrial Product',
				'slug' => 'industrial-product',
				'image_url' => 'images/1079b7a0.1.jpg',
				'big_image_url' => 'images/b01146d5.slide1.jpg'
			)
		);
		Category::create(
			array(
				'title' => 'Others',
				'slug' => 'other',
				'image_url' => 'images/1079b7a0.1.jpg',
				'big_image_url' => 'images/b01146d5.slide1.jpg'
			)
		);
	}

}
class UserTableSeeder extends Seeder
{

	public function run()
	{
		DB::table('users')->delete();

		User::create(
			array(
				'email' => 'wengchaoda@gmail.com',
				'username' => 'admin',
				'password' => Hash::make('airsto'),
				'isAdmin' => true
			)
		);
		User::create(
			array(
				'email' => 'huqiyuan800@sina.com',
				'username' => 'huqiyuan800',
				'password' => Hash::make('123456'),
				'isAdmin' => false
			)
		);
	}

}